package com.corpgovernment.supplier.mapper;

import com.corpgovernment.organization.common.mybatis.TkMapper;
import com.corpgovernment.supplier.entity.db.SupplierCompanyContract;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SupplierCompanyContractMapper extends TkMapper<SupplierCompanyContract> {
    /**
     * 根据供应商公司关联主键 查询合同
     *
     * @param supplierCompanyId 供应商公司关联id
     * @return 合同
     */
    @Select("select * from mb_supplier_company_contract where supplier_company_id = #{supplierCompanyId}")
    SupplierCompanyContract selectBySupplierCompanyId(@Param("supplierCompanyId") Long supplierCompanyId);

    @Select({
            "<script>",
            "select * from mb_supplier_company_contract where supplier_company_id IN ",
            "<foreach collection='supplierCompanyIdList' item='supplierCompanyId' open='(' separator=',' close=')'>",
            "#{supplierCompanyId}",
            "</foreach>",
            "</script>"
    })
    List<SupplierCompanyContract> selectBySupplierCompanyIdList(@Param("supplierCompanyIdList") List<Long> supplierCompanyIdList);
}
